package com.macro.mall.portal.config.sharding.ranghash;

import cn.hutool.core.util.HashUtil;
import com.macro.mall.common.utils.IdUtils;
import com.macro.mall.portal.domain.ShardGroup;
import com.macro.mall.portal.domain.ShardNode;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;

import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * @author wwj
 */
public class RangHashPreciseDBShardingAlgorithm implements PreciseShardingAlgorithm<Long> {


    @Override
    public String doSharding(Collection<String> dbNames, PreciseShardingValue<Long> preciseShardingValue) {

        return RangeHashAlgorithm.getNodeName(preciseShardingValue.getLogicTableName(), preciseShardingValue.getValue());

    }


}
